package cm.shit;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;


class TimePrinter implements ActionListener {
    // 暂时不用管参数
    @Override
    public void actionPerformed(ActionEvent e) {
        System.out.println("At the tone , the time is " + new Date());
        Toolkit.getDefaultToolkit().beep();
    }
}
public class TestActionListener {
    public static void main(String[] args) {
        ActionListener actionListener = new TimePrinter();
        Timer t = new Timer(1000, actionListener);
        t.start();
        JOptionPane.showMessageDialog(null, "QUit?");
        System.exit(0);

    }
}
